package pack3;

class Rectangle extends Shape {
    private double x;
    private double y;
    private double length;
    private double width;

    public Rectangle(double x, double y, double length, double width) {
        this.x = x;
        this.y = y;
        this.length = length;
        this.width = width;
        name = "Rectangle";
    }

    @Override
    public double calculateArea() {
        return length * width;
    }

    @Override
    public double calculatePerimeter() {
        return 2 * (length + width);
    }

    @Override
    public void show() {
        System.out.println("矩形: 中心位置 [" + x + "," + y + "], width = " + width + ", length = " + length);
    }
}